function characterNeedsScoreMultiplier(e) {
    if (!e || 0 === e.length)
        return !1;
    var t = e.charCodeAt(0);
    return t > 11904 && t < 12031 || (t > 12352 && t < 12543 || (t > 12736 && t < 19903 || (t > 19968 && t < 40959 || (t > 44032 && t < 55215 || (t > 63744 && t < 64255 || (t > 65072 && t < 65103 || (t > 131072 && t < 173791 || t > 194560 && t < 195103)))))))
}
function domDistance(e, t, n) {
    for (var i = [], r = e; r; )
        i.unshift(r),
        r = r.parentNode;
    var a = [];
    for (r = t; r; )
        a.unshift(r),
        r = r.parentNode;
    for (var l = Math.min(i.length, a.length), o = Math.abs(i.length - a.length), s = l; s >= 0 && i[s] !== a[s]; --s)
        if (o += 2,
        n && o >= n)
            return n;
    return o
}
function fontSizeFromComputedStyle(e, t) {
    var n = parseInt(e.fontSize);
    return isNaN(n) && (n = t || BaseFontSize),
    n
}
function contentTextStyleForNode(e, t) {
    function n(e) {
        if (isNodeWhitespace(e))
            return null;
        var t = getComputedStyle(e.parentNode);
        return "none" !== t.float ? null : t
    }
    for (var i = e.evaluate("descendant::text()[not(parent::h1) and not(parent::h2) and not(parent::h3) and not(parent::h4) and not(parent::h5) and not(parent::h6)]", t, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null), r = i.snapshotLength, a = 0; a < r; ++a) {
        for (var l = i.snapshotItem(a), o = !1, s = l.parentElement; s !== t; s = s.parentElement)
            if (NegativeRegEx.test(s.className)) {
                o = !0;
                break
            }
        if (!o) {
            var c = n(l);
            if (c)
                return c
        }
    }
    return null
}
function isNodeWhitespace(e) {
    return !(!e || e.nodeType !== Node.TEXT_NODE) && !/\S/.test(e.data)
}
function removeWhitespace(e) {
    return e.replace(/\s+/g, "")
}
function isElementNode(e) {
    return !(!e || e.nodeType !== Node.ELEMENT_NODE)
}
function computedStyleIndicatesElementIsInvisibleDueToClipping(e) {
    if ("absolute" !== e.position)
        return !1;
    var t = e.clip.match(/^rect\((\d+px|auto), (\d+px|auto), (\d+px|auto), (\d+px|auto)\)$/);
    if (!t || 5 !== t.length)
        return !1;
    var n = t.map((function(e) {
        return parseInt(e)
    }
    ))
      , i = n[1];
    isNaN(i) && (i = 0);
    var r = n[2]
      , a = n[3]
      , l = n[4];
    return isNaN(l) && (l = 0),
    i >= a || r >= l
}
function isElementVisible(e) {
    var t = getComputedStyle(e);
    if ("visible" !== t.visibility || "none" === t.display)
        return !1;
    if (cachedElementBoundingRect(e).height)
        return !0;
    var n = document.createRange();
    return n.selectNode(e),
    !!n.getBoundingClientRect().height
}
function isElementPositionedOffScreen(e) {
    var t = cachedElementBoundingRect(e);
    return !(!t.height || !t.width) && (t.bottom <= 0 || t.right <= 0)
}
function elementDepth(e) {
    for (var t = 0; e; e = e.parentElement)
        t++;
    return t
}
function depthOfElementWithinElement(e, t) {
    for (var n = 0; e !== t; e = e.parentElement)
        n++;
    return n
}
function nearestAncestorElementWithTagName(e, t) {
    for (; e = e.parentElement; )
        if (e.tagName === t)
            return e;
    return null
}
function cachedElementBoundingRect(e) {
    if (e._cachedElementBoundingRect)
        return e._cachedElementBoundingRect;
    var t = e.getBoundingClientRect();
    return ReaderArticleFinderJS._elementsWithCachedBoundingRects.push(e),
    ReaderArticleFinderJS._cachedScrollX || ReaderArticleFinderJS._cachedScrollY ? (e._cachedElementBoundingRect = {
        top: t.top + ReaderArticleFinderJS._cachedScrollY,
        right: t.right + ReaderArticleFinderJS._cachedScrollX,
        bottom: t.bottom + ReaderArticleFinderJS._cachedScrollY,
        left: t.left + ReaderArticleFinderJS._cachedScrollX,
        width: t.width,
        height: t.height
    },
    e._cachedElementBoundingRect) : (e._cachedElementBoundingRect = t,
    e._cachedElementBoundingRect)
}
function clearCachedElementBoundingRects() {
    for (var e = ReaderArticleFinderJS._elementsWithCachedBoundingRects, t = e.length, n = 0; n < t; ++n)
        e[n]._cachedElementBoundingRect = null;
    ReaderArticleFinderJS._elementsWithCachedBoundingRects = []
}
function innerTextOrTextContent(e) {
    var t = e.innerText;
    return /\S/.test(t) || (t = e.textContent),
    t
}
function levenshteinDistance(e, t) {
    for (var n = e.length, i = t.length, r = new Array(n + 1), a = 0; a < n + 1; ++a)
        r[a] = new Array(i + 1),
        r[a][0] = a;
    for (var l = 0; l < i + 1; ++l)
        r[0][l] = l;
    for (l = 1; l < i + 1; ++l)
        for (a = 1; a < n + 1; ++a)
            if (e[a - 1] === t[l - 1])
                r[a][l] = r[a - 1][l - 1];
            else {
                var o = r[a - 1][l] + 1
                  , s = r[a][l - 1] + 1
                  , c = r[a - 1][l - 1] + 1;
                r[a][l] = Math.min(o, s, c)
            }
    return r[n][i]
}
function stringSimilarity(e, t) {
    var n = Math.max(e.length, t.length);
    return n ? (n - levenshteinDistance(e, t)) / n : 0
}
function stringsAreNearlyIdentical(e, t) {
    return e === t || stringSimilarity(e, t) > StringSimilarityToDeclareStringsNearlyIdentical
}
function elementIsCommentBlock(e) {
    if (/(^|\s)comment/.test(e.className))
        return !0;
    var t = e.getAttribute("id");
    return !(!t || 0 !== t.indexOf("comment"))
}
function elementLooksLikeEmbeddedTweet(e) {
    if ("IFRAME" !== e.tagName)
        return !1;
    if (!e.contentDocument)
        return !1;
    var t = e.contentDocument.documentElement
      , n = 0
      , i = t.querySelector("blockquote");
    return i && /http.+twitter.com.*status.*[0-9]+/i.test(i.getAttribute("cite")) && ++n,
    e.classList.contains("twitter-tweet") && ++n,
    t.querySelector("[data-iframe-title='Embedded Tweet']") && ++n,
    t.querySelector("[data-tweet-id]") && ++n,
    n > 2
}
function elementLooksLikePartOfACarousel(e) {
    const t = /carousel-|carousel_|-carousel|_carousel/;
    for (var n = e, i = 0; i < 3; ++i) {
        if (!n)
            return !1;
        if (t.test(n.className) || t.test(n.getAttribute("data-analytics")))
            return !0;
        n = n.parentElement
    }
}
function shouldPruneIframe(e, t) {
    return !HostnamesKnownToContainEmbeddableMediaRegex.test(anchorForURL(e.src, t).hostname) && !elementLooksLikeEmbeddedTweet(e.originalElement)
}
function languageScoreMultiplierForTextNodes(e) {
    if (!e || !e.length)
        return 1;
    for (var t = Math.min(e.length, DefaultNumberOfTextNodesToCheckForLanguageMultiplier), n = 0, i = 0, r = 0; r < t; r++) {
        for (var a = e[r].nodeValue.trim(), l = Math.min(a.length, NumberOfCharactersPerTextNodeToEvaluateForLanguageMultiplier), o = 0; o < l; o++)
            characterNeedsScoreMultiplier(a[o]) && n++;
        i += l
    }
    return n >= i * MinimumRatioOfCharactersForLanguageMultiplier ? ScoreMultiplierForChineseJapaneseKorean : 1
}
function scoreMultiplierForElementTagNameAndAttributes(e) {
    for (var t = 1, n = e; n; n = n.parentElement) {
        var i = n.getAttribute("id");
        i && (ArticleRegEx.test(i) && (t += ArticleMatchBonus),
        CommentRegEx.test(i) && (t -= CommentMatchPenalty));
        var r = n.className;
        r && (ArticleRegEx.test(r) && (t += ArticleMatchBonus),
        CommentRegEx.test(r) && (t -= CommentMatchPenalty)),
        "ARTICLE" === n.tagName && (t += ArticleMatchBonus)
    }
    return t < 0 ? 0 : t
}
function elementAtPoint(e, t) {
    if ("undefined" != typeof ReaderArticleFinderJSController && ReaderArticleFinderJSController.nodeAtPoint) {
        var n = ReaderArticleFinderJSController.nodeAtPoint(e, t);
        return n && n.nodeType !== Node.ELEMENT_NODE && (n = n.parentElement),
        n
    }
    return document.elementFromPoint(e, t)
}
function userVisibleURLString(e) {
    return "undefined" != typeof ReaderArticleFinderJSController && ReaderArticleFinderJSController.userVisibleURLString ? ReaderArticleFinderJSController.userVisibleURLString(e) : e
}
function anchorForURL(e, t) {
    var n = t.createElement("a");
    return n.href = e,
    n
}
function anchorLinksToAttachment(e) {
    return /\battachment\b/i.test(e.getAttribute("rel"))
}
function anchorLinksToTagOrCategoryPage(e) {
    return /\bcategory|tag\b/i.test(e.getAttribute("rel"))
}
function elementsHaveSameTagAndClassNames(e, t) {
    return e.tagName === t.tagName && e.className === t.className
}
function selectorForElement(e) {
    for (var t = e.tagName, n = e.classList, i = n.length, r = 0; r < i; r++)
        t += "." + n[r];
    return t
}
function elementFingerprintForDepth(e, t) {
    const n = " / "
      , i = " \\"
      , r = " | ";
    return function e(t, a) {
        if (!t)
            return "";
        var l = [];
        l.push(selectorForElement(t));
        var o = t.children
          , s = o.length;
        if (s && a > 0) {
            l.push(n);
            for (var c = 0; c < s; ++c)
                l.push(e(o[c], a - 1)),
                c !== s - 1 && l.push(r);
            l.push(i)
        }
        return l.join("")
    }(e, t)
}
function childrenOfParentElement(e) {
    var t = e.parentElement;
    return t ? t.children : []
}
function arrayOfKeysAndValuesOfObjectSortedByValueDescending(e) {
    var t = [];
    for (var n in e)
        e.hasOwnProperty(n) && t.push({
            key: n,
            value: e[n]
        });
    return t.sort((function(e, t) {
        return t.value - e.value
    }
    )),
    t
}
function walkElementSubtree(e, t, n) {
    if (!(t < 0)) {
        for (var i = e.children, r = i.length, a = t - 1, l = 0; l < r; ++l)
            walkElementSubtree(i[l], a, n);
        n(e, t)
    }
}
function childrenWithParallelStructure(e) {
    var t = e.children;
    if (!t)
        return [];
    var n = t.length;
    if (!n)
        return [];
    for (var i = {}, r = 0; r < n; ++r) {
        var a = t[r];
        if (!CandidateTagNamesToIgnore[a.tagName] && a.className)
            for (var l = a.classList, o = l.length, s = 0; s < o; ++s) {
                (u = i[h = l[s]]) ? u.push(a) : i[h] = [a]
            }
    }
    var c = Math.floor(n / 2);
    for (var h in i) {
        var u;
        if ((u = i[h]).length > c)
            return u
    }
    return []
}
const ReaderMinimumScore = 1600
  , ReaderMinimumAdvantage = 15
  , ArticleMinimumScoreDensity = 4.25
  , BlacklistedHostsAllowedPathRegexMap = {
    "www.apple.com": /^\/([a-z]{2,4}\/){0,2}pr\/|^\/hotnews\//,
    "extensions.apple.com": null
}
  , ListOfHostnameAndTrustedArticleNodeSelectorPairs = [[/.*\.apple.com$/, "article"]]
  , CandidateMinimumWidth = 280
  , CandidateMinimumHeight = 295
  , CandidateMinimumArea = 17e4
  , CandidateMaximumTop = 1300
  , CandidateMinimumWidthPortionForIndicatorElements = .5
  , CandidateMinumumListItemLineCount = 4
  , CandidateTagNamesToIgnore = {
    A: 1,
    EMBED: 1,
    FORM: 1,
    HTML: 1,
    IFRAME: 1,
    OBJECT: 1,
    OL: 1,
    OPTION: 1,
    SCRIPT: 1,
    STYLE: 1,
    svg: 1,
    UL: 1
}
  , PrependedArticleCandidateMinimumHeight = 50
  , AppendedArticleCandidateMinimumHeight = 200
  , AppendedArticleCandidateMaximumVerticalDistanceFromArticle = 150
  , StylisticClassNames = {
    justfy: 1,
    justify: 1,
    left: 1,
    right: 1,
    small: 1
}
  , CommentRegEx = /comment|meta|footer|footnote/
  , CommentMatchPenalty = .75
  , ArticleRegEx = /(?:(?:^|\s)(?:(post|hentry|entry)[-_]?(?:content|text|body)?|article[-_]?(?:content|text|body|page)?)(?:\s|$))/i
  , ArticleMatchBonus = .5
  , DensityExcludedElementSelector = "#disqus_thread, #comments, .userComments"
  , AttributesToRemoveRegEx = /^on|^id$|^class$|^style$/
  , PositiveRegEx = /article|body|content|entry|hentry|page|pagination|post|text/i
  , NegativeRegEx = /advertisement|breadcrumb|combx|comment|contact|disqus|footer|link|meta|mod-conversations|promo|related|scroll|share|shoutbox|sidebar|social|sponsor|subscribe|tags|toolbox|widget|_ad$/i
  , VeryPositiveClassNameRegEx = /instapaper_body/
  , VeryNegativeClassNameRegEx = /instapaper_ignore/
  , SharingRegex = /email|print|rss|digg|slashdot|delicious|reddit|share/i
  , HostnamesKnownToContainEmbeddableMediaRegex = /youtube|vimeo|dailymotion/
  , MinimumAverageDistanceBetweenHRElements = 400
  , MinimumAverageDistanceBetweenHeaderElements = 400
  , PortionOfCandidateHeightToIgnoreForHeaderCheck = .1
  , DefaultNumberOfTextNodesToCheckForLanguageMultiplier = 3
  , NumberOfCharactersPerTextNodeToEvaluateForLanguageMultiplier = 12
  , MinimumRatioOfCharactersForLanguageMultiplier = .5
  , ScoreMultiplierForChineseJapaneseKorean = 3
  , MinimumContentMediaHeight = 150
  , MinimumContentMediaWidthToArticleWidthRatio = .25
  , MaximumContentMediaAreaToArticleAreaRatio = .2
  , LinkContinueMatchRegEx = /continue/gi
  , LinkNextMatchRegEx = /next/gi
  , LinkPageMatchRegEx = /page/gi
  , LinkListItemBonus = 5
  , LinkPageMatchBonus = 10
  , LinkNextMatchBonus = 15
  , LinkContinueMatchBonus = 15
  , LinkNextOrdinalValueBase = 3
  , LinkMismatchValueBase = 2
  , LinkMatchWeight = 200
  , LinkMaxVerticalDistanceFromArticle = 200
  , LinkVerticalDistanceFromArticleWeight = 150
  , LinkCandidateXPathQuery = "descendant-or-self::*[(not(@id) or (@id!='disqus_thread' and @id!='comments')) and (not(@class) or @class!='userComments')]/a"
  , LinkDateRegex = /\D(?:\d\d(?:\d\d)?[\-\/](?:10|11|12|0?[1-9])[\-\/](?:30|31|[12][0-9]|0?[1-9])|\d\d(?:\d\d)?\/(?:10|11|12|0[1-9])|(?:10|11|12|0?[1-9])\-(?:30|31|[12][0-9]|0?[1-9])\-\d\d(?:\d\d)?|(?:30|31|[12][0-9]|0?[1-9])\-(?:10|11|12|0?[1-9])\-\d\d(?:\d\d)?)\D/
  , LinkURLSearchParameterKeyMatchRegex = /(page|^p$|^pg$)/i
  , LinkURLPageSlashNumberMatchRegex = /\/.*page.*\/\d+/i
  , LinkURLSlashDigitEndMatchRegex = /\/\d+\/?$/
  , LinkURLArchiveSlashDigitEndMatchRegex = /archives?\/\d+\/?$/
  , LinkURLBadSearchParameterKeyMatchRegex = /author|comment|feed|id|nonce|related/i
  , LinkURLSemanticMatchBonus = 100
  , LinkMinimumURLSimilarityRatio = .75
  , HeaderMinimumDistanceFromArticleTop = 200
  , HeaderLevenshteinDistanceToLengthRatio = .75
  , MinimumRatioOfListItemsBeingRelatedToSharingToPruneEntireList = .5
  , FloatMinimumHeight = 130
  , ImageSizeTiny = 32
  , ToleranceForLeadingImageWidthToArticleWidthForFullWidthPresentation = 50
  , MaximumFloatWidth = 325
  , AnchorImageMinimumWidth = 100
  , AnchorImageMinimumHeight = 100
  , MinimumHeightForImagesAboveTheArticleTitle = 50
  , MainImageMinimumWidthAndHeight = 83
  , BaseFontSize = 16
  , BaseLineHeightRatio = 1.125
  , MaximumExactIntegralValue = 9007199254740992
  , TitleCandidateDepthScoreMultiplier = .1
  , DocumentPositionDisconnected = 1
  , DocumentPositionPreceding = 2
  , DocumentPositionFollowing = 4
  , DocumentPositionContains = 8
  , DocumentPositionContainedBy = 16
  , TextNodeLengthPower = 1.25
  , KnownImageLazyLoadingAttributes = {
    "data-lazy-src": 1,
    "data-original": 1,
    "data-src": 1,
    "original-src": 1,
    "rel:bf_image_src": 1
}
  , StringSimilarityToDeclareStringsNearlyIdentical = .97;
CandidateElement = function(e, t) {
    this.element = e,
    this.contentDocument = t,
    this.textNodes = this.usableTextNodesInElement(this.element),
    this.rawScore = this.calculateRawScore(),
    this.tagNameAndAttributesScoreMultiplier = this.calculateElementTagNameAndAttributesScoreMultiplier(),
    this.languageScoreMultiplier = 0,
    this.depthInDocument = 0
}
,
CandidateElement.extraArticleCandidateIfElementIsViable = function(e, t, n, i) {
    var r = cachedElementBoundingRect(e)
      , a = cachedElementBoundingRect(t.element);
    if ((i && r.height < 50 || !i && r.height < 200) && e.childElementCount && e.querySelectorAll("*").length !== e.querySelectorAll("a, b, strong, i, em, u, span").length)
        return null;
    if (i) {
        if (r.bottom > a.top)
            return null
    } else if (r.top < a.bottom)
        return null;
    if (!i && r.top - a.bottom > 150)
        return null;
    if (r.left > a.right || r.right < a.left)
        return null;
    if (elementLooksLikePartOfACarousel(e))
        return null;
    var l = new CandidateElement(e,n);
    return l.isPrepended = i,
    l
}
,
CandidateElement.candidateIfElementIsViable = function(e, t, n) {
    var i = cachedElementBoundingRect(e);
    return i.width < 280 || i.height < 295 || i.width * i.height < 17e4 || !n && i.top > 1300 || CandidateElement.candidateElementAdjustedHeight(e) < 295 ? null : new CandidateElement(e,t)
}
,
CandidateElement.candidateElementAdjustedHeight = function(e) {
    for (var t = cachedElementBoundingRect(e), n = t.height, i = e.getElementsByTagName("form"), r = i.length, a = 0; a < r; ++a) {
        var l = cachedElementBoundingRect(i[a]);
        l.width > .5 * t.width && (n -= l.height)
    }
    var o = e.querySelectorAll("ol, ul")
      , s = o.length
      , c = null;
    for (a = 0; a < s; ++a) {
        var h = o[a];
        if (!(c && 16 & c.compareDocumentPosition(h))) {
            var u = h.getElementsByTagName("li")
              , d = u.length
              , m = cachedElementBoundingRect(h);
            if (d) {
                var g = m.height / d
                  , f = getComputedStyle(u[0])
                  , p = parseInt(f.lineHeight);
                if (isNaN(p))
                    p = 1.125 * fontSizeFromComputedStyle(f);
                m.width > .5 * t.width && g / p < 4 && (n -= m.height,
                c = h)
            } else
                n -= m.height
        }
    }
    return n
}
,
CandidateElement.prototype = {
    calculateRawScore: function() {
        for (var e = 0, t = this.textNodes, n = t.length, i = 0; i < n; ++i)
            e += this.rawScoreForTextNode(t[i]);
        return e
    },
    calculateElementTagNameAndAttributesScoreMultiplier: function() {
        return scoreMultiplierForElementTagNameAndAttributes(this.element)
    },
    calculateLanguageScoreMultiplier: function() {
        0 === this.languageScoreMultiplier && (this.languageScoreMultiplier = languageScoreMultiplierForTextNodes(this.textNodes))
    },
    depth: function() {
        return this.depthInDocument || (this.depthInDocument = elementDepth(this.element)),
        this.depthInDocument
    },
    finalScore: function() {
        return this.calculateLanguageScoreMultiplier(),
        this.basicScore() * this.languageScoreMultiplier
    },
    basicScore: function() {
        return this.rawScore * this.tagNameAndAttributesScoreMultiplier
    },
    scoreDensity: function() {
        var e = 0
          , t = this.element.querySelector(DensityExcludedElementSelector);
        t && (e = t.clientWidth * t.clientHeight);
        for (var n = this.element.children || [], i = n.length, r = 0; r < i; ++r) {
            var a = n[r];
            elementIsCommentBlock(a) && (e += a.clientWidth * a.clientHeight)
        }
        var l = cachedElementBoundingRect(this.element).width * cachedElementBoundingRect(this.element).height
          , o = .2 * l
          , s = .25 * cachedElementBoundingRect(this.element).width
          , c = this.element.querySelectorAll("img, object, video")
          , h = c.length;
        for (r = 0; r < h; ++r) {
            var u = cachedElementBoundingRect(c[r]);
            if (u.width >= s && u.height > 150) {
                var d = u.width * u.height;
                d < o && (e += d)
            }
        }
        var m = this.basicScore()
          , g = l - e
          , f = this.textNodes.length
          , p = 0
          , E = 0;
        for (r = 0; r < f; ++r) {
            var v = this.textNodes[r].parentNode;
            v && (E += fontSizeFromComputedStyle(getComputedStyle(v)),
            p++)
        }
        var N = BaseFontSize;
        return p && (N = E /= p),
        this.calculateLanguageScoreMultiplier(),
        m / g * 1e3 * (N / BaseFontSize) * this.languageScoreMultiplier
    },
    usableTextNodesInElement: function(e) {
        var t = [];
        if (!e)
            return t;
        const n = {
            A: 1,
            DD: 1,
            DT: 1,
            NOSCRIPT: 1,
            OL: 1,
            OPTION: 1,
            PRE: 1,
            SCRIPT: 1,
            STYLE: 1,
            TD: 1,
            UL: 1,
            IFRAME: 1
        };
        var i = this.contentDocument
          , r = function(e) {
            for (var r = i.evaluate("text()|*/text()|*/a/text()|*/li/text()|*/span/text()|*/em/text()|*/i/text()|*/strong/text()|*/b/text()|*/font/text()|blockquote/*/text()|div[count(./p)=count(./*)]/p/text()", e, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null), a = r.snapshotLength, l = 0; l < a; ++l) {
                var o = r.snapshotItem(l);
                n[o.parentNode.tagName] || o._countedTextNode || isNodeWhitespace(o) || (o._countedTextNode = !0,
                t.push(o))
            }
        };
        r(e);
        for (var a = childrenWithParallelStructure(e), l = a.length, o = 0; o < l; ++o) {
            r(a[o])
        }
        var s = t.length;
        for (o = 0; o < s; ++o)
            delete t[o]._countedTextNode;
        return t
    },
    addTextNodesFromCandidateElement: function(e) {
        for (var t = this.textNodes.length, n = 0; n < t; ++n)
            this.textNodes[n].alreadyCounted = !0;
        var i = e.textNodes
          , r = i.length;
        for (n = 0; n < r; ++n)
            i[n].alreadyCounted || this.textNodes.push(i[n]);
        for (t = this.textNodes.length,
        n = 0; n < t; ++n)
            this.textNodes[n].alreadyCounted = null;
        this.rawScore = this.calculateRawScore()
    },
    rawScoreForTextNode: function(e) {
        if (!e)
            return 0;
        var t = e.length;
        if (t < 20)
            return 0;
        var n = e.parentNode;
        if (!isElementVisible(n))
            return 0;
        for (var i = 1; n && n !== this.element; )
            i -= .1,
            n = n.parentNode;
        return Math.pow(t * i, 1.25)
    },
    shouldDisqualifyDueToScoreDensity: function() {
        return this.scoreDensity() < 4.25
    },
    shouldDisqualifyDueToHorizontalRuleDensity: function() {
        for (var e = this.element.getElementsByTagName("hr"), t = e.length, n = 0, i = cachedElementBoundingRect(this.element), r = .7 * i.width, a = 0; a < t; ++a)
            e[a].clientWidth > r && n++;
        if (n && i.height / n < 400)
            return !0;
        return !1
    },
    shouldDisqualifyDueToHeaderDensity: function() {
        var e = this.contentDocument.evaluate("(h1|h2|h3|h4|h5|h6|*/h1|*/h2|*/h3|*/h4|*/h5|*/h6)[a[@href]]", this.element, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
          , t = e.snapshotLength;
        if (t > 2) {
            for (var n = 0, i = cachedElementBoundingRect(this.element), r = .1 * i.height, a = 0; a < t; ++a) {
                var l = cachedElementBoundingRect(e.snapshotItem(a));
                l.top - i.top > r && i.bottom - l.bottom > r && n++
            }
            if (i.height / n < 400)
                return !0
        }
        return !1
    },
    shouldDisqualifyDueToSimilarElements: function(e) {
        function t(e) {
            return !!{
                H1: 1,
                H2: 1,
                H3: 1,
                H4: 1,
                H5: 1,
                H6: 1
            }[e.tagName]
        }
        function n(e, t) {
            if (!e || !t)
                return !1;
            return e.className ? e.className === t.className : elementFingerprintForDepth(e, 1) === elementFingerprintForDepth(t, 1)
        }
        const i = /clearfix/i
          , r = "h1, h2, h3, h4, h5, h6";
        var a = this.element;
        if ("LI" === a.tagName || "DD" === a.tagName)
            for (var l = a.parentNode, o = l.children.length, s = 0; s < o; ++s) {
                if ((E = l.children[s]).tagName === a.tagName && E.className === a.className && E !== a)
                    return !0
            }
        var c = a.getAttribute("class");
        if (c || (a = a.parentElement) && ((c = a.getAttribute("class")) || (a = a.parentElement) && (c = a.getAttribute("class"))),
        c) {
            e || (e = []);
            var h, u = e.length;
            for (s = 0; s < u; ++s)
                e[s].element.candidateElement = e[s];
            try {
                var d = c.split(" ")
                  , m = "";
                for (s = 0; s < d.length; ++s)
                    i.test(d[s]) || d[s].length && (m += "." + d[s]);
                h = this.contentDocument.querySelectorAll(m)
            } catch (e) {
                h = []
            }
            var g = !1
              , f = elementDepth(a)
              , p = h.length;
            for (s = 0; s < p; ++s) {
                var E;
                if ((E = h[s]) !== a && (E.parentElement !== a && a.parentElement !== E && isElementVisible(E))) {
                    var v = E.candidateElement;
                    if ((v || (v = new CandidateElement(E,this.contentDocument))) && 15 * v.basicScore() > this.basicScore()) {
                        if (!g && cachedElementBoundingRect(E).bottom < cachedElementBoundingRect(this.element).top) {
                            g = !0;
                            continue
                        }
                        if (n(a.previousElementSibling, E.previousElementSibling) || n(a.nextElementSibling, E.nextElementSibling)) {
                            var N = a.querySelector(r)
                              , S = E.querySelector(r);
                            if (N && S && elementsHaveSameTagAndClassNames(N, S))
                                return !0;
                            if (N = a.previousElementSibling,
                            S = E.previousElementSibling,
                            N && S && t(N) && t(S) && elementsHaveSameTagAndClassNames(N, S))
                                return !0
                        }
                        if (elementDepth(E) === f)
                            for (; E.parentElement && a.parentElement && E.parentElement !== a.parentElement; )
                                E = E.parentElement,
                                a = a.parentElement;
                        for (; a.childElementCount <= 1; ) {
                            if (!a.childElementCount || !E.childElementCount)
                                return !1;
                            if (E.childElementCount > 1)
                                return !1;
                            if (a.firstElementChild.tagName !== E.firstElementChild.tagName)
                                return !1;
                            a = a.firstElementChild,
                            E = E.firstElementChild
                        }
                        if (E.childElementCount <= 1)
                            return !1;
                        S = E.firstElementChild;
                        var T = E.lastElementChild
                          , A = (N = a.firstElementChild,
                        a.lastElementChild);
                        if (S.tagName !== N.tagName)
                            return !1;
                        if (T.tagName !== A.tagName)
                            return !1;
                        var x = S.className
                          , y = T.className
                          , b = N.className
                          , C = T.className
                          , R = C === b ? 2 : 1;
                        if (x.length || b.length) {
                            if (!x.length || !b.length)
                                return !1;
                            if (x === b && a.querySelectorAll("." + b.replace(/\s+/, ".")).length <= R)
                                return !0
                        }
                        if (y.length || C.length) {
                            if (!y.length || !C.length)
                                return !1;
                            if (y === C && a.querySelectorAll("." + C.replace(/\s+/, ".")).length <= R)
                                return !0
                        }
                        var D = N.clientHeight
                          , L = A.clientHeight;
                        return !(!D || !S.clientHeight) && (!(!L || !T.clientHeight) && (D === S.clientHeight || L === T.clientHeight))
                    }
                }
            }
            for (s = 0; s < u; ++s)
                e[s].element.candidateElement = null
        }
        return !1
    },
    shouldDisqualifyForDeepLinking: function() {
        function e(e) {
            var t = e.pathname.substring(1).split("/");
            return t[t.length - 1] || t.pop(),
            t
        }
        for (var t = this.element, n = this.contentDocument.location, i = e(n).length, r = [], a = t.getElementsByTagName("a"), l = a.length, o = 0; o < l; o++) {
            var s = a[o];
            if (n.host === s.host && !(e(s).length <= i || 0 !== (s.host + s.pathname).indexOf(n.host + n.pathname) || anchorLinksToAttachment(s) || (r.push(s),
            r.length < 5))) {
                var c = t.offsetTop + t.offsetHeight / 5;
                return r[0].offsetTop < c
            }
        }
        return !1
    }
},
String.prototype.lastInteger = function() {
    var e = this.match(/[0-9]+/g);
    return e ? parseInt(e[e.length - 1]) : NaN
}
,
String.prototype.escapeCharacters = function(e) {
    for (var t = !1, n = e.length, i = 0; i < n; ++i)
        if (-1 !== this.indexOf(e.charAt(i))) {
            t = !0;
            break
        }
    if (!t)
        return this;
    var r = ""
      , a = this.length;
    for (i = 0; i < a; ++i)
        -1 !== e.indexOf(this.charAt(i)) && (r += "\\"),
        r += this.charAt(i);
    return r
}
,
String.prototype.escapeForRegExp = function() {
    return this.escapeCharacters("^[]{}()\\.$*+?|")
}
,
ReaderArticleFinder = function(e) {
    this.contentDocument = e,
    this.didSearchForArticleNode = !1,
    this.article = null,
    this.didSearchForExtraArticleNode = !1,
    this.extraArticle = null,
    this.leadingImage = null,
    this._cachedScrollY = 0,
    this._cachedScrollX = 0,
    this._elementsWithCachedBoundingRects = [],
    this._cachedContentTextStyle = null,
    this.pageNumber = 1,
    this.prefixWithDateForNextPageURL = null,
    this._elementsEvaluatedForTextContent = [],
    this.previouslyDiscoveredPageURLStrings = []
}
,
ReaderArticleFinder.prototype = {
    isReaderModeAvailable: function() {
        return this.canRunReaderDetection() ? !!this.findArticleBySearchingWhitelist() || (this.cacheWindowScrollPosition(),
        this.article = this.findArticleByVisualExamination(),
        this.article && this.articleIsLTR(),
        !!this.article) : null
    },
    prepareToTransitionToReader: function() {
        this.adoptableArticle(!0),
        this.nextPageURL(),
        this.articleIsLTR()
    },
    nextPageURL: function() {
        if (!this._nextPageURL) {
            var e = this.nextPageURLString();
            "undefined" != typeof ReaderArticleFinderJSController && e && (e = ReaderArticleFinderJSController.substituteURLForNextPageURL(e)),
            this._nextPageURL = e
        }
        return this._nextPageURL
    },
    containerElementsForMultiPageContent: function() {
        const e = /(.*page.*)(\d{1,2})(.*)/i;
        for (var t, n = [], i = this.articleNode(), r = 0; !(t = e.exec(i.getAttribute("id"))); )
            if (!(i = i.parentElement) || 3 == r++)
                return [];
        for (var a = childrenOfParentElement(i), l = a.length, o = 0; o < l; ++o) {
            var s = a[o];
            if (s !== i) {
                var c = e.exec(s.getAttribute("id"));
                c && c[1] === t[1] && c[3] === t[3] && (isElementVisible(s) && !isElementPositionedOffScreen(s) || n.push(s))
            }
        }
        return n
    },
    adoptableMultiPageContentElements: function() {
        return this.containerElementsForMultiPageContent().map((function(e) {
            return this.cleanArticleNode(e, e.cloneNode(!0), !1)
        }
        ), this)
    },
    classNameIsSignificantInRouteComputation: function(e) {
        return !!e && !(e.toLowerCase()in StylisticClassNames)
    },
    shouldIgnoreInRouteComputation: function(e) {
        return "SCRIPT" === e.tagName || "LINK" === e.tagName || "STYLE" === e.tagName || "TR" === e.tagName && !e.offsetHeight
    },
    routeToArticleNode: function() {
        for (var e = [], t = this.articleNode(); t; ) {
            var n = {};
            n.tagName = t.tagName;
            var i = t.getAttribute("id");
            i && (n.id = i),
            this.classNameIsSignificantInRouteComputation(t.className) && (n.className = t.className),
            n.index = 1;
            for (var r = t.previousElementSibling; r; r = r.previousElementSibling)
                this.shouldIgnoreInRouteComputation(r) || n.index++;
            e.unshift(n),
            t = t.parentElement
        }
        return e
    },
    adjustArticleNode: function() {
        if (this.article) {
            var e;
            for (e = this.article.element; e; e = e.parentElement)
                if (VeryPositiveClassNameRegEx.test(e.className))
                    return void (this.article.element = e);
            if ("SECTION" === (e = this.article.element).tagName && e.parentElement && "articleBody" === e.parentElement.getAttribute("itemprop"))
                this.article.element = e.parentElement;
            else if (!(e = this.article.element).getAttribute("id") && e.className)
                for (var t = e.tagName, n = e.className, i = e.parentElement, r = i.children, a = 0, l = r.length; a < l; ++a) {
                    var o = r[a];
                    if (o !== e && (o.tagName === t && o.className === n)) {
                        var s = CandidateElement.candidateIfElementIsViable(o, this.contentDocument, !0);
                        if (s && !(s.finalScore() < 1600))
                            return void (this.article.element = i)
                    }
                }
        }
    },
    findArticleBySearchingWhitelist: function() {
        for (var e = ListOfHostnameAndTrustedArticleNodeSelectorPairs.length, t = 0; t < e; ++t) {
            var n = ListOfHostnameAndTrustedArticleNodeSelectorPairs[t];
            if (n[0].test(this.contentDocument.location.hostname)) {
                var i = n[1]
                  , r = this.contentDocument.querySelectorAll(i);
                if (1 === r.length)
                    return new CandidateElement(r[0],this.contentDocument)
            }
        }
        return null
    },
    articleNode: function(e) {
        return this.didSearchForArticleNode || (this.article = this.findArticleBySearchingWhitelist(),
        this.article || (this.article = this.findArticleBySearchingAllElements()),
        this.article || (this.article = this.findArticleByVisualExamination()),
        !this.article && e && (this.article = this.findArticleBySearchingAllElements(!0)),
        this.adjustArticleNode(),
        this.didSearchForArticleNode = !0,
        this.article && this.articleIsLTR()),
        this.article ? this.article.element : null
    },
    extraArticleNode: function() {
        return this.didSearchForArticleNode || this.articleNode(),
        this.didSearchForExtraArticleNode || (this.extraArticle = this.findExtraArticle(),
        this.didSearchForExtraArticleNode = !0),
        this.extraArticle ? this.extraArticle.element : null
    },
    cacheWindowScrollPosition: function() {
        this._cachedScrollY = window.scrollY,
        this._cachedScrollX = window.scrollX
    },
    contentTextStyle: function() {
        return this._cachedContentTextStyle || (this._cachedContentTextStyle = contentTextStyleForNode(this.contentDocument, this.articleNode()),
        this._cachedContentTextStyle || (this._cachedContentTextStyle = getComputedStyle(this.articleNode()))),
        this._cachedContentTextStyle
    },
    commaCountIsLessThan: function(e, t) {
        for (var n = 0, i = e.textContent, r = -1; n < t && (r = i.indexOf(",", r + 1)) >= 0; )
            n++;
        return n < t
    },
    calculateLinkDensity: function(e) {
        var t = removeWhitespace(e.textContent).length;
        if (!t)
            return 0;
        for (var n = e.getElementsByTagName("a"), i = 0, r = n.length, a = 0; a < r; ++a)
            i += removeWhitespace(n[a].textContent).length;
        return i / t
    },
    shouldPruneElement: function(e, t) {
        var n = e.tagName;
        if (!e.parentElement)
            return !1;
        if ("IFRAME" === n)
            return shouldPruneIframe(e, this.contentDocument);
        if ("OBJECT" !== n && "EMBED" !== n && "CANVAS" !== n) {
            for (var i = !1, r = e.childNodes.length, a = 0; a < r; ++a) {
                var l = e.childNodes[a]
                  , o = l.nodeType;
                if (o === Node.ELEMENT_NODE || o === Node.TEXT_NODE && !isNodeWhitespace(l)) {
                    i = !0;
                    break
                }
            }
            if (!i) {
                if ("P" === n) {
                    var s = e.previousSibling
                      , c = e.nextSibling;
                    if (s && s.nodeType === Node.TEXT_NODE && !isNodeWhitespace(s) && c && c.nodeType === Node.TEXT_NODE && !isNodeWhitespace(c))
                        return !1
                }
                return !0
            }
            if ("P" === n)
                return !1
        }
        if ("CANVAS" === n)
            return "CUFON" === e.parentNode.tagName;
        var h = 0;
        if (t) {
            if (VeryNegativeClassNameRegEx.test(t.className))
                return !0;
            var u = t.className
              , d = t.getAttribute("id");
            PositiveRegEx.test(u) && h++,
            PositiveRegEx.test(d) && h++,
            NegativeRegEx.test(u) && h--,
            NegativeRegEx.test(d) && h--
        }
        if (h < 0)
            return !0;
        if (e.querySelector(".tweet-wrapper"))
            return !1;
        if ("UL" === n || "OL" === n) {
            if (t.querySelector("iframe") && t.querySelector("script"))
                return !0;
            var m = t.children
              , g = m.length;
            if (!g)
                return !0;
            var f = 0
              , p = 0;
            for (a = 0; a < g; ++a)
                SharingRegex.test(m[a].className) && f++,
                NegativeRegEx.test(m[a].className) && p++;
            return f / g >= .5 || p / g >= .5
        }
        if ("OBJECT" === n) {
            var E = e.querySelector("embed[src]")
              , v = E ? anchorForURL(E.src, this.contentDocument) : null;
            if (v && HostnamesKnownToContainEmbeddableMediaRegex.test(v.hostname))
                return !1;
            var N = e.getAttribute("data");
            return !(v = N ? anchorForURL(N, this.contentDocument) : null) || !HostnamesKnownToContainEmbeddableMediaRegex.test(v.hostname)
        }
        if (1 === e.childElementCount) {
            var S = e.firstElementChild;
            if ("A" === S.tagName)
                return !1;
            if ("SPAN" === S.tagName && "converted-anchor" === S.className && nearestAncestorElementWithTagName(S, "TABLE"))
                return !1
        }
        var T = e.getElementsByTagName("img")
          , A = T.length;
        if (A) {
            var x = 0;
            for (a = 0; a < A; ++a) {
                var y = T[a].originalElement;
                if (isElementVisible(y)) {
                    var b = cachedElementBoundingRect(y);
                    x += b.width / A * (b.height / A)
                }
            }
            if (x > 4e4)
                return !1
        }
        if (!this.commaCountIsLessThan(e, 10))
            return !1;
        var C = e.getElementsByTagName("p").length
          , R = e.getElementsByTagName("br").length
          , D = C + Math.floor(R / 2);
        if (A > D)
            return !0;
        if (e.getElementsByTagName("li").length > D)
            return !0;
        if (e.getElementsByTagName("input").length / D > .33)
            return !0;
        if (e.textContent.length < 25 && 1 !== A)
            return !0;
        if (e.querySelector("embed"))
            return !0;
        var L = this.calculateLinkDensity(e);
        if (h >= 1 && L > .5)
            return !0;
        if (h < 1 && L > .2)
            return !0;
        if ("TABLE" === n && removeWhitespace(e.innerText).length <= .5 * removeWhitespace(t.innerText).length)
            return !0;
        return !1
    },
    wordCountIsLessThan: function(e, t) {
        for (var n = 0, i = e.textContent, r = -1; (r = i.indexOf(" ", r + 1)) >= 0 && n < t; )
            n++;
        return n < t
    },
    leadingImageIsAppropriateWidth: function(e) {
        return !(!this.article || !e) && e.getBoundingClientRect().width >= this.article.element.getBoundingClientRect().width - 50
    },
    newDivFromNode: function(e) {
        var t = this.contentDocument.createElement("div");
        return e && (t.innerHTML = e.innerHTML),
        t
    },
    adoptableLeadingImage: function() {
        const e = /credit/
          , t = /caption/
          , n = /src|alt/;
        if (!this.article || !this.leadingImage || !this.leadingImageIsAppropriateWidth(this.leadingImage))
            return null;
        var i = this.leadingImage.parentNode
          , r = null
          , a = null
          , l = i.children.length;
        if ("DIV" === i.tagName && l > 1 && l < 5)
            for (var o = i.cloneNode(!0).querySelectorAll("p, div"), s = o.length, c = 0; c < s; ++c) {
                var h = o[c];
                e.test(h.className) ? r = h.cloneNode(!0) : t.test(h.className) && (a = h.cloneNode(!0))
            }
        var u = this.leadingImage.cloneNode(!1)
          , d = u.attributes;
        for (c = 0; c < d.length; ++c) {
            var m = d[c].nodeName;
            n.test(m) || (u.removeAttribute(m),
            c--)
        }
        var g = this.contentDocument.createElement("div");
        if (g.className = "leading-image",
        g.appendChild(u),
        r) {
            var f = this.newDivFromNode(r);
            f.className = "credit",
            g.appendChild(f)
        }
        if (a) {
            var p = this.newDivFromNode(a);
            p.className = "caption",
            g.appendChild(p)
        }
        return g
    },
    adoptableArticle: function(e) {
        if (this._adoptableArticle)
            return this._adoptableArticle.cloneNode(!0);
        clearCachedElementBoundingRects(),
        this.cacheWindowScrollPosition();
        var t = this.articleNode(e);
        if (this._adoptableArticle = t ? t.cloneNode(!0) : null,
        !this._adoptableArticle)
            return this._adoptableArticle;
        if (this._articleBoundingRect = cachedElementBoundingRect(this.article.element),
        this._adoptableArticle = this.cleanArticleNode(t, this._adoptableArticle, !1),
        "P" === this._adoptableArticle.tagName) {
            var n = document.createElement("div");
            n.appendChild(this._adoptableArticle),
            this._adoptableArticle = n
        }
        var i = this.extraArticleNode();
        if (i) {
            var r = this.cleanArticleNode(i, i.cloneNode(!0), !0);
            r && (this.extraArticle.isPrepended ? this._adoptableArticle.insertBefore(r, this._adoptableArticle.firstChild) : this._adoptableArticle.appendChild(r));
            var a = cachedElementBoundingRect(this.article.element)
              , l = cachedElementBoundingRect(this.extraArticle.element)
              , o = {
                top: Math.min(a.top, l.top),
                right: Math.max(a.right, l.right),
                bottom: Math.max(a.bottom, l.bottom),
                left: Math.min(a.left, l.left)
            };
            o.width = o.right - o.left,
            o.height = o.bottom - o.top,
            this._articleBoundingRect = o
        }
        this._articleTextContent = this._adoptableArticle.innerText;
        var s = this.adoptableLeadingImage();
        return s && this._adoptableArticle.insertBefore(s, this._adoptableArticle.firstChild),
        this._adoptableArticle
    },
    elementPinToEdge: function(e) {
        if (window.scrollY < 120)
            return null;
        var t = cachedElementBoundingRect(e)
          , n = e.ownerDocument.elementFromPoint((t.left + t.right) / 2, 0);
        n && n.tagName in {
            AREA: 1,
            BR: 1,
            CANVAS: 1,
            EMBED: 1,
            FRAME: 1,
            HR: 1,
            IMG: 1,
            INPUT: 1
        } && (n = n.parentElement);
        for (var i = n; i && i !== e; )
            i = i.parentNode;
        return i ? n : null
    },
    dominantContentSelectorAndDepth: function(e) {
        var t = {}
          , n = {};
        walkElementSubtree(e, 2, (function(e, i) {
            if (isElementVisible(e)) {
                var r = selectorForElement(e) + " | " + i;
                n[r] ? n[r] += 1 : (n[r] = 1,
                t[r] = e)
            }
        }
        ));
        var i, r = arrayOfKeysAndValuesOfObjectSortedByValueDescending(n);
        switch (r.length) {
        case 0:
            break;
        case 1:
            i = r[0].key;
            break;
        default:
            var a = r[0];
            a.value > r[1].value && (i = a.key)
        }
        if (!i)
            return null;
        var l = t[i];
        return {
            selector: selectorForElement(l),
            depth: depthOfElementWithinElement(l, e)
        }
    },
    functionToPreventPruningElementDueToInvisibility: function() {
        const e = [[/nytimes.com/, function(e, t) {
            var n = e;
            if (!t)
                return !1;
            for (; n && n !== t; ) {
                if (n.classList.contains("hidden"))
                    return !0;
                n = n.parentElement
            }
            return !1
        }
        ]];
        for (var t = e.length, n = 0; n < t; ++n) {
            var i = e[n];
            if (i[0].test(this.contentDocument.location.hostname))
                return i[1]
        }
        return function() {
            return !1
        }
    },
    cleanArticleNode: function(e, t, n) {
        function i(e) {
            h += e,
            u && (u += e),
            d && (d += e),
            m && (m += e),
            g && (g += e)
        }
        function r(t) {
            if (cachedElementBoundingRect(t).height > 50)
                return !1;
            return !!{
                UL: 1,
                LI: 1,
                NAV: 1
            }[t.tagName] || t.parentElement === e && !t.nextElementSibling
        }
        const a = {
            FORM: 1,
            SCRIPT: 1,
            STYLE: 1,
            LINK: 1
        }
          , l = {
            DIV: 1,
            TABLE: 1,
            OBJECT: 1,
            UL: 1,
            CANVAS: 1,
            P: 1,
            IFRAME: 1,
            ASIDE: 1,
            SECTION: 1,
            FOOTER: 1,
            NAV: 1,
            OL: 1
        }
          , o = {
            I: 1,
            EM: 1
        }
          , s = {
            B: 1,
            STRONG: 1,
            H1: 1,
            H2: 1,
            H3: 1,
            H4: 1,
            H5: 1,
            H6: 1
        };
        var c = []
          , h = 0
          , u = 0
          , d = 0
          , m = 0
          , g = 0
          , f = e
          , p = f.ownerDocument.defaultView
          , E = t
          , v = this.articleTitle()
          , N = this._articleTitleElement
          , S = this.elementPinToEdge(e)
          , T = null
          , A = isElementVisible(e)
          , x = this.dominantContentSelectorAndDepth(e)
          , y = function() {
            var t = cachedElementBoundingRect(e);
            if (0 === t.width || 0 === t.height)
                return !0;
            var n, i = childrenWithParallelStructure(e), r = i.length;
            if (r) {
                n = [];
                for (var a = 0; a < r; ++a) {
                    var l = i[a];
                    if ("none" === getComputedStyle(l).float)
                        for (var o = l.children, s = o.length, c = 0; c < s; ++c)
                            n.push(o[c]);
                    else
                        n.push(l)
                }
            } else
                n = e.children;
            var h = n.length
              , u = 0;
            for (a = 0; a < h; ++a) {
                var d = n[a];
                "none" !== getComputedStyle(d).float && (u += d.innerText.length)
            }
            return u / e.innerText.length > .8
        }()
          , b = new Set;
        this.previouslyDiscoveredPageURLStrings.forEach((function(e) {
            b.add(e)
        }
        ));
        var C = this.nextPageURL();
        C && b.add(C);
        var R = null;
        this._articleTitleElement && (R = cachedElementBoundingRect(this._articleTitleElement));
        for (var D = this.functionToPreventPruningElementDueToInvisibility(); f; ) {
            var L, M = null, I = E.tagName;
            if (E.originalElement = f,
            f === S && (T = E),
            I in a && (M = E),
            !M && f === N && (M = E),
            !M && ("H1" === I || "H2" === I))
                if (f.offsetTop - e.offsetTop < 200) {
                    var P = innerTextOrTextContent(f)
                      , B = .75 * P.length;
                    levenshteinDistance(v, P) <= B && (M = E)
                }
            if (M || this.isMediaWikiPage() && /editsection/.test(f.className) && (M = E),
            M || (L = getComputedStyle(f)),
            !M && "DIV" === I && E.parentNode) {
                var w = f.querySelectorAll("a, blockquote, dl, div, img, ol, p, pre, table, ul");
                if (!(u || "none" !== L.float) && !w.length) {
                    for (var F = E.parentNode, _ = this.contentDocument.createElement("p"); E.firstChild; ) {
                        var O = E.firstChild;
                        _.appendChild(O)
                    }
                    F.replaceChild(_, E),
                    T === E && (T = _),
                    (E = _).originalElement = f,
                    I = E.tagName
                }
            }
            if (!M && E.parentNode && I in l && c.push(E),
            !M) {
                if (A)
                    if ("none" === L.display || "visible" !== L.visibility || computedStyleIndicatesElementIsInvisibleDueToClipping(L))
                        !(!!x && (h === x.depth && selectorForElement(f) === x.selector)) && !D(f, e) && (M = E);
                isElementPositionedOffScreen(f) ? M = E : f !== e && !u && "none" !== L.float && !y && (cachedElementBoundingRect(f).height >= 130 || f.childElementCount > 1) && (u = 1)
            }
            if (!M) {
                for (var k = E.attributes, H = 0; H < k.length; ++H) {
                    var W = k[H].nodeName;
                    AttributesToRemoveRegEx.test(W) && (E.removeAttribute(W),
                    H--)
                }
                if ("both" === L.clear && E.classList.add("clear"),
                ("UL" === I || "OL" === I) && "none" === L["list-style-type"] && "none" === L["background-image"]) {
                    var q = f.children
                      , V = q.length
                      , U = !0;
                    for (H = 0; H < V; ++H) {
                        var z = getComputedStyle(q[H]);
                        if ("none" !== z["list-style-type"] || 0 !== parseInt(z["-webkit-padding-start"])) {
                            U = !1;
                            break
                        }
                    }
                    U && E.classList.add("list-style-type-none")
                }
                if (!m && "normal" !== L.fontStyle && (I in o || (E.style.fontStyle = L.fontStyle),
                m = 1),
                !g && "normal" !== L.fontWeight && (I in s || (E.style.fontWeight = L.fontWeight),
                g = 1),
                u) {
                    1 === u && (cachedElementBoundingRect(f).width <= 325 ? E.setAttribute("class", "auxiliary float " + L.float) : E.classList.add("auxiliary"));
                    var J = f.style.getPropertyValue("width");
                    if (J)
                        E.style.width = J;
                    else if (p && p.getMatchedCSSRules) {
                        var X = p.getMatchedCSSRules(f, "", !0);
                        if (X)
                            for (H = X.length - 1; H >= 0; --H)
                                if (J = X[H].style.getPropertyValue("width")) {
                                    E.style.width = J;
                                    break
                                }
                    }
                    1 === u && !J && (E.style.width = cachedElementBoundingRect(f).width + "px");
                    var Y = E.parentNode === t ? 36 : 12
                      , K = E.style.width;
                    K && parseInt(K) >= screen.width - Y && E.setAttribute("class", "large-element")
                }
                if ("TABLE" === I)
                    d || (d = 1);
                else if ("VIDEO" === I) {
                    const e = 36;
                    cachedElementBoundingRect(f).width > screen.width - e && E.setAttribute("class", "large-element")
                } else if ("IMG" === I) {
                    var j = !1
                      , $ = k.length;
                    for (H = 0; H < $; ++H) {
                        W = k[H].nodeName;
                        if (KnownImageLazyLoadingAttributes[W.toLowerCase()]) {
                            E.setAttribute("src", E.getAttribute(W)),
                            j = !0;
                            break
                        }
                    }
                    E.removeAttribute("border"),
                    E.removeAttribute("hspace"),
                    E.removeAttribute("vspace");
                    var G = E.getAttribute("align");
                    if (E.removeAttribute("align"),
                    "left" !== G && "right" !== G || (E.classList.add("float"),
                    E.classList.add(G)),
                    !u && !j) {
                        var Q = cachedElementBoundingRect(f)
                          , Z = Q.width
                          , ee = Q.height;
                        1 === Z && 1 === ee || R && ee < 50 && Q.bottom < R.top ? M = E : Z < 32 && ee < 32 && E.setAttribute("class", "reader-image-tiny")
                    }
                } else if ("FONT" === I)
                    E.removeAttribute("size"),
                    E.removeAttribute("face"),
                    E.removeAttribute("color");
                else if ("A" === I && E.parentNode) {
                    var te = E.getAttribute("href");
                    if (te && te.length && ("#" === te[0] || "javascript:" === te.substring(0, 11))) {
                        if (!d && !E.childElementCount && 1 === E.parentElement.childElementCount && "LI" !== E.parentElement.tagName)
                            this.contentDocument.evaluate("text()", E.parentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null).snapshotLength || (M = E);
                        if (!M) {
                            _ = this.contentDocument.createElement("span");
                            if (1 === E.childElementCount && "IMG" === E.firstElementChild.tagName) {
                                var ne = E.firstElementChild;
                                ne.width > 100 && ne.height > 100 && _.setAttribute("class", "converted-image-anchor")
                            }
                            for (_.className || _.setAttribute("class", "converted-anchor"); E.firstChild; )
                                _.appendChild(E.firstChild);
                            E.parentNode.replaceChild(_, E),
                            T === (E = _) && (T = _)
                        }
                    }
                }
            }
            if (!M && elementIsCommentBlock(f) && (M = E),
            !M && "A" === I && b.has(f.href)) {
                for (var ie, re, ae = f, le = E; (ae = ae.parentElement) && (le = le.parentElement); ) {
                    const t = 10;
                    if (cachedElementBoundingRect(ae).top - cachedElementBoundingRect(f).top > t)
                        break;
                    if (ae === e)
                        break;
                    r(ae) && (ie = ae,
                    re = le)
                }
                ie && (M = re,
                f = ie,
                (E = re).originalElement = f,
                I = E.tagName),
                ae = null,
                le = null,
                ie = null,
                re = null
            }
            var oe = M ? null : f.firstElementChild;
            if (oe)
                f = oe,
                E = E.firstElementChild,
                i(1);
            else {
                for (var se; f !== e && !(se = f.nextElementSibling); )
                    f = f.parentElement,
                    E = E.parentElement,
                    i(-1);
                if (f === e) {
                    if (M)
                        if (M.parentElement)
                            M.remove();
                        else if (n)
                            return null;
                    break
                }
                f = se,
                E = E.nextElementSibling,
                1 === u && (u = 0),
                1 === d && (d = 0),
                1 === m && (m = 0),
                1 === g && (g = 0)
            }
            if (M)
                if (M.parentElement)
                    M.remove();
                else if (n)
                    return null
        }
        var ce = t.querySelectorAll("iframe")
          , he = ce.length;
        for (H = 0; H < he; ++H) {
            var ue = ce[H];
            if (elementLooksLikeEmbeddedTweet(ue.originalElement)) {
                var de = this.adoptableSimpleTweetFromTwitterIframe(ue);
                de && ue.parentElement.replaceChild(de, ue)
            }
        }
        for (H = c.length - 1; H >= 0; --H) {
            var me = c[H];
            me.parentNode && this.shouldPruneElement(me, me.originalElement) && (T === me && ((T = me.nextElementSibling) || (T = me.parentElement)),
            me.remove())
        }
        var ge = t.querySelectorAll(".float");
        for (H = 0; H < ge.length; ++H) {
            var fe = !1
              , pe = ge[H];
            if (!fe) {
                var Ee = pe.querySelectorAll("a, span.converted-image-anchor")
                  , ve = pe.querySelectorAll("span.converted-anchor");
                fe = pe.parentNode && ve.length > Ee.length
            }
            if (!fe) {
                var Ne = pe.querySelectorAll("embed, object").length
                  , Se = pe.originalElement.querySelectorAll("embed, object").length;
                !Ne && Se && (fe = !0)
            }
            if (!fe) {
                for (var Te = pe.originalElement.getElementsByTagName("img"), Ae = Te.length, xe = 0, ye = 0; ye < Ae && (A && isElementVisible(Te[ye]) && xe++,
                !(xe > 1)); ++ye)
                    ;
                if (1 === xe)
                    pe.getElementsByTagName("img").length || (fe = !0)
            }
            fe && (T === pe && ((T = pe.nextElementSibling) || (T = pe.parentElement)),
            pe.remove())
        }
        if (n && !removeWhitespace(t.innerText).length)
            return null;
        if (T) {
            var be = document.createElement("div")
              , Ce = T.originalElement.getBoundingClientRect()
              , Re = Ce.height > 0 ? 100 * Ce.top / Ce.height : 0;
            be.style.position = "relative",
            be.style.top = Math.round(-Re) + "%",
            be.setAttribute("id", "safari-reader-element-marker"),
            T.insertBefore(be, T.firstChild)
        }
        return t
    },
    adoptableSimpleTweetFromTwitterIframe: function(e) {
        var t = e.originalElement.contentDocument.documentElement.querySelector("[data-tweet-id].expanded");
        if (!t)
            return null;
        var n = this.contentDocument.createElement("div");
        n.classList.add("tweet-wrapper");
        var i = this.contentDocument.createElement("blockquote");
        i.classList.add("simple-tweet"),
        n.appendChild(i);
        var r = t.getAttribute("data-tweet-id");
        n.setAttribute("data-reader-tweet-id", r);
        var a = t.querySelector(".dateline")
          , l = t.querySelector('[data-scribe="element:screen_name"]')
          , o = t.querySelector('[data-scribe="element:name"]')
          , s = t.querySelector(".e-entry-title");
        if (!(a && l && o && s))
            return n;
        var c = "&mdash; " + o.innerText + " (" + l.innerText + ")"
          , h = this.contentDocument.createElement("p");
        h.innerHTML = s.innerHTML,
        i.appendChild(h),
        i.insertAdjacentHTML("beforeend", c);
        var u = this.contentDocument.createElement("span");
        u.innerHTML = a.innerHTML,
        i.appendChild(u);
        for (var d = i.querySelectorAll("img.twitter-emoji"), m = d.length, g = 0; g < m; ++g) {
            var f = d[g]
              , p = f.getAttribute("alt");
            if (p && p.length > 0) {
                var E = this.contentDocument.createElement("span");
                E.innerText = p,
                f.parentNode.replaceChild(E, f)
            }
        }
        return n
    },
    leadingImageNode: function() {
        if (!this.article || !this.article.element)
            return null;
        for (var e = this.article.element, t = 0; t < 3 && e.parentNode; ++t) {
            var n = (e = e.parentNode).getElementsByTagName("img")[0];
            if (n) {
                var i = cachedElementBoundingRect(n);
                if (i.height >= 250 && i.width >= .5 * this._articleWidth) {
                    var r = this.article.element.compareDocumentPosition(n);
                    if (!(2 & r) || 16 & r)
                        continue;
                    if ((r = this.extraArticle ? this.extraArticle.element.compareDocumentPosition(n) : null) && (!(2 & r) || 16 & r))
                        continue;
                    return n
                }
            }
        }
        return null
    },
    mainImageNode: function() {
        var e = this.leadingImageNode();
        if (e)
            return e;
        if (this.article && this.article.element)
            for (var t = this.article.element.querySelectorAll("img"), n = t.length, i = 0; i < n; ++i) {
                var r = t[i]
                  , a = r._cachedElementBoundingRect;
                if (a || (a = r.getBoundingClientRect()),
                a.width >= 83 && a.height >= 83)
                    return r
            }
        return null
    },
    articleTitle: function() {
        function e(e, t) {
            var n = e ? t.indexOf(e) : -1;
            return -1 !== n && (0 === n || n + e.length === t.length)
        }
        function t(e, t) {
            return e.host === t.host && e.pathname === t.pathname
        }
        if (!this.articleNode())
            return;
        if (this._articleTitle)
            return this._articleTitle;
        const n = /header|title|headline|instapaper_title/i
          , i = /byline|author/i;
        var r = function(e) {
            var t = this.contentDocument.querySelector(e)
              , n = t && 2 === t.attributes.length ? t.content : null;
            if (n) {
                var i = this.articleTitleAndSiteNameFromTitleString(n);
                i && (n = i.articleTitle)
            }
            return n
        }
        .bind(this)
          , a = this.contentDocument.title
          , l = r("head meta[property='og:title']")
          , o = r("head meta[name='twitter:title']")
          , s = cachedElementBoundingRect(this.articleNode());
        this.extraArticleNode() && this.extraArticle.isPrepended && (s = cachedElementBoundingRect(this.extraArticleNode()));
        var c = s.left + s.width / 2
          , h = s.top
          , u = h;
        (this._articleWidth = s.width,
        this.leadingImage = this.leadingImageNode(),
        this.leadingImage) && (u = (cachedElementBoundingRect(this.leadingImage).top + h) / 2);
        var d = "h1, h2, h3, h4, h5, .headline, .article_title, #hn-headline, .inside-head, .instapaper_title"
          , m = this.article.element.tagName;
        "DL" !== m && "DD" !== m || (d += ", dt");
        var g = this.contentDocument.querySelectorAll(d);
        g = Array.prototype.slice.call(g, 0);
        for (var f = this.contentDocument.location, p = this.article.element.getElementsByTagName("a"), E = 0; E < p.length; E++) {
            var v = p[E];
            if (v.offsetTop > this.articleNode().offsetTop + 20)
                break;
            if (t(v, f)) {
                g.push(v);
                break
            }
        }
        var N, S = g.map(innerTextOrTextContent), T = g.length, A = 0, x = [], y = [], b = [];
        for (E = 0; E < T; ++E) {
            var C = g[E]
              , R = stringSimilarity(a, q = S[E]);
            if (l) {
                var D = stringSimilarity(l, q);
                R += D,
                D > StringSimilarityToDeclareStringsNearlyIdentical && y.push(C)
            }
            if (o) {
                var L = stringSimilarity(o, q);
                R += L,
                L > StringSimilarityToDeclareStringsNearlyIdentical && b.push(C)
            }
            R === A ? x.push(C) : R > A && (A = R,
            x = [C])
        }
        if (1 === y.length ? (N = y[0]).headerText = innerTextOrTextContent(N) : 1 === b.length && ((N = b[0]).headerText = innerTextOrTextContent(N)),
        !N)
            for (E = 0; E < T; ++E) {
                if (isElementVisible(C = g[E])) {
                    var M = cachedElementBoundingRect(C)
                      , I = M.left + M.width / 2
                      , P = I - c
                      , B = M.top + M.height / 2 - u
                      , w = -1 !== y.indexOf(C)
                      , F = -1 !== b.indexOf(C)
                      , _ = C.classList.contains("instapaper_title")
                      , O = "headline" === C.getAttribute("itemprop")
                      , k = w || F || _ || O
                      , H = Math.sqrt(P * P + B * B)
                      , W = k ? 500 : Math.max(500 - H, 0)
                      , q = S[E]
                      , V = C.getAttribute("property");
                    if (V) {
                        var U = /dc.title/i.exec(V);
                        if (U && U[0])
                            if (1 === this.contentDocument.querySelectorAll('*[property~="' + U[0] + '"]').length) {
                                (N = C).headerText = q;
                                break
                            }
                    }
                    if (!i.test(C.className)) {
                        if (!k) {
                            if (H > 500)
                                continue;
                            if (I < s.left || I > s.right)
                                continue
                        }
                        if (a && stringsAreNearlyIdentical(q, a))
                            W *= 3;
                        else if (e(q, a))
                            W *= 1.5;
                        else if (q.length < 8)
                            continue;
                        var z = !1
                          , J = nearestAncestorElementWithTagName(C, "A");
                        if (J || (J = C.querySelector("a")),
                        J) {
                            var X = J.host === f.host
                              , Y = J.pathname === f.pathname;
                            if (X && Y)
                                W *= 1.5;
                            else {
                                if (X && nearestAncestorElementWithTagName(C, "LI"))
                                    continue;
                                W *= .6,
                                z = !0
                            }
                        }
                        var K = fontSizeFromComputedStyle(getComputedStyle(C));
                        z || (W *= K / BaseFontSize),
                        W *= 1 + .1 * elementDepth(C);
                        var j = parseInt(this.contentTextStyle().fontSize);
                        parseInt(K) > 1.1 * j && (W *= 1.25),
                        (n.test(C.className) || n.test(C.getAttribute("id"))) && (W *= 1.5);
                        var $ = C.parentElement;
                        $ && (n.test($.className) || n.test($.getAttribute("id"))) && (W *= 1.5),
                        -1 !== x.indexOf(C) && (W *= 1.8),
                        (!N || W > N.headerScore) && ((N = C).headerScore = W,
                        N.headerText = q)
                    }
                }
            }
        if (N && domDistance(N, this.articleNode(), 10) > 9 && parseInt(getComputedStyle(N).fontSize) < 1.5 * j && (N = null),
        N) {
            this._articleTitleElement = N;
            var G = N.headerText.trim();
            l && e(l, G) ? this._articleTitle = l : a && e(a, G) ? this._articleTitle = a : this._articleTitle = G
        }
        return this._articleTitle || (l && e(l, a) ? this._articleTitle = l : this._articleTitle = a),
        this._articleTitle
    },
    articleIsLTR: function() {
        if (!this._articleIsLTR) {
            var e = getComputedStyle(this.article.element);
            this._articleIsLTR = !e || "ltr" === e.direction
        }
        return this._articleIsLTR
    },
    findSuggestedCandidate: function() {
        var e, t, n = this.suggestedRouteToArticle;
        if (!n || !n.length)
            return null;
        for (t = n.length - 1; t >= 0 && (!n[t].id || !(e = this.contentDocument.getElementById(n[t].id))); --t)
            ;
        for (t++,
        e || (e = this.contentDocument); t < n.length; ) {
            for (var i = n[t], r = e.nodeType === Node.DOCUMENT_NODE ? e.documentElement : e.firstElementChild, a = 1; r && a < i.index; r = r.nextElementSibling)
                this.shouldIgnoreInRouteComputation(r) || a++;
            if (!r)
                return null;
            if (r.tagName !== i.tagName)
                return null;
            if (i.className && r.className !== i.className)
                return null;
            e = r,
            t++
        }
        return isElementVisible(e) ? new CandidateElement(e,this.contentDocument) : null
    },
    canRunReaderDetection: function() {
        var e = this.contentDocument.location.hostname
          , t = this.contentDocument.location.pathname;
        for (var n in BlacklistedHostsAllowedPathRegexMap) {
            if (new RegExp(n.escapeForRegExp()).test(e)) {
                var i = BlacklistedHostsAllowedPathRegexMap[n];
                return i instanceof RegExp && i.test(t)
            }
        }
        return !0
    },
    findArticleBySearchingAllElements: function(e) {
        var t = this.findSuggestedCandidate()
          , n = this.findCandidateElements();
        if (!n || !n.length)
            return t;
        if (t && t.basicScore() >= 1600)
            return t;
        for (var i = this.highestScoringCandidateFromCandidates(n), r = i.element; r !== this.contentDocument; r = r.parentNode)
            if ("BLOCKQUOTE" === r.tagName) {
                for (var a = r.parentNode, l = n.length, o = 0; o < l; ++o) {
                    var s = n[o];
                    if (s.element === a) {
                        i = s;
                        break
                    }
                }
                break
            }
        if (t && i.finalScore() < 1600)
            return t;
        if (!e) {
            if (i.shouldDisqualifyDueToScoreDensity())
                return null;
            if (i.shouldDisqualifyDueToHorizontalRuleDensity())
                return null;
            if (i.shouldDisqualifyDueToHeaderDensity())
                return null;
            if (i.shouldDisqualifyDueToSimilarElements(n))
                return null
        }
        return i
    },
    findExtraArticle: function() {
        if (!this.article)
            return null;
        for (var e = 0, t = this.article.element; e < 3 && t; ++e,
        t = t.parentNode) {
            var n = this.findExtraArticleCandidateElements(t);
            if (n && n.length)
                for (var i, r = this.sortCandidateElementsInDescendingScoreOrder(n), a = 0; a < r.length && ((i = r[a]) && i.basicScore()); a++)
                    if (!i.shouldDisqualifyDueToScoreDensity() && !i.shouldDisqualifyDueToHorizontalRuleDensity() && !(i.shouldDisqualifyDueToHeaderDensity() || cachedElementBoundingRect(i.element).height < 50 && cachedElementBoundingRect(this.article.element).width !== cachedElementBoundingRect(i.element).width)) {
                        var l = contentTextStyleForNode(this.contentDocument, i.element);
                        if (l && l.fontFamily === this.contentTextStyle().fontFamily && l.fontSize === this.contentTextStyle().fontSize && i)
                            return i
                    }
        }
        return null
    },
    highestScoringCandidateFromCandidates: function(e) {
        for (var t = 0, n = null, i = e.length, r = 0; r < i; ++r) {
            var a = e[r]
              , l = a.basicScore();
            l >= t && (t = l,
            n = a)
        }
        return n
    },
    sortCandidateElementsInDescendingScoreOrder: function(e) {
        return e.sort((function(e, t) {
            return e.basicScore() !== t.basicScore() ? t.basicScore() - e.basicScore() : t.depth() - e.depth()
        }
        ))
    },
    findCandidateElements: function() {
        for (var e = Date.now() + 1e3, t = this.contentDocument.getElementsByTagName("*"), n = t.length, i = [], r = 0; r < n; ++r) {
            var a = t[r];
            if (!CandidateTagNamesToIgnore[a.tagName]) {
                var l = CandidateElement.candidateIfElementIsViable(a, this.contentDocument);
                if (l && i.push(l),
                Date.now() > e) {
                    i = [];
                    break
                }
            }
        }
        var o = i.length;
        for (r = 0; r < o; ++r)
            i[r].element.candidateElement = i[r];
        for (r = 0; r < o; ++r) {
            var s = i[r];
            if ("BLOCKQUOTE" === s.element.tagName) {
                var c = s.element.parentElement.candidateElement;
                c && c.addTextNodesFromCandidateElement(s)
            }
        }
        for (r = 0; r < o; ++r)
            i[r].element.candidateElement = null;
        return i
    },
    findExtraArticleCandidateElements: function(e) {
        if (!this.article)
            return [];
        e || (e = this.article.element);
        for (var t = "preceding-sibling::*/descendant-or-self::*", n = this.contentDocument.evaluate(t, e, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null), i = n.snapshotLength, r = [], a = 0; a < i; ++a) {
            var l = n.snapshotItem(a);
            if (!CandidateTagNamesToIgnore[l.tagName])
                (o = CandidateElement.extraArticleCandidateIfElementIsViable(l, this.article, this.contentDocument, !0)) && r.push(o)
        }
        t = "following-sibling::*/descendant-or-self::*",
        i = (n = this.contentDocument.evaluate(t, e, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)).snapshotLength;
        for (a = 0; a < i; ++a) {
            var o;
            l = n.snapshotItem(a);
            if (!CandidateTagNamesToIgnore[l.tagName])
                (o = CandidateElement.extraArticleCandidateIfElementIsViable(l, this.article, this.contentDocument, !1)) && r.push(o)
        }
        return r
    },
    isGeneratedBy: function(e) {
        var t = this.contentDocument.head ? this.contentDocument.head.querySelector("meta[name=generator]") : null;
        if (!t)
            return !1;
        var n = t.content;
        return !!n && e.test(n)
    },
    isMediaWikiPage: function() {
        return this.isGeneratedBy(/^MediaWiki /)
    },
    isWordPressSite: function() {
        return this.isGeneratedBy(/^WordPress/)
    },
    nextPageURLString: function() {
        if (!this.article)
            return null;
        if (this.isMediaWikiPage())
            return null;
        var e, t = 0, n = this.article.element;
        n.parentNode && "inline" === getComputedStyle(n).display && (n = n.parentNode);
        for (var i = n, r = cachedElementBoundingRect(n).bottom + 200; isElementNode(i) && cachedElementBoundingRect(i).bottom <= r; )
            i = i.parentNode;
        i !== n && (i === this.contentDocument || isElementNode(i)) && (n = i);
        var a = this.contentDocument.evaluate(LinkCandidateXPathQuery, n, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
          , l = a.snapshotLength;
        if (this.pageNumber <= 2 && !this.prefixWithDateForNextPageURL) {
            var o = this.contentDocument.location.pathname
              , s = o.match(LinkDateRegex);
            s && (s = s[0],
            this.prefixWithDateForNextPageURL = o.substring(0, o.indexOf(s) + s.length))
        }
        for (var c = 0; c < l; ++c) {
            var h = a.snapshotItem(c)
              , u = this.scoreNextPageLinkCandidate(h);
            u > t && (e = h,
            t = u)
        }
        return e ? e.href : null
    },
    scoreNextPageLinkCandidate: function(e) {
        function t(e, t, n, i) {
            t.substring(0, e.length) === e && (t = t.substring(e.length),
            e = "");
            var r = t.lastInteger();
            if (isNaN(r))
                return !1;
            var a = e ? e.lastInteger() : NaN;
            return (isNaN(a) || a >= 9007199254740992) && (a = i),
            r === a ? n.lastInteger() === a + 1 : r === a + 1
        }
        function n(e) {
            for (var t = {}, n = e.substring(1).split("&"), i = n.length, r = 0; r < i; ++r) {
                var a = n[r]
                  , l = a.indexOf("=");
                -1 === l ? t[a] = null : t[a.substring(0, l)] = a.substring(l + 1)
            }
            return t
        }
        var i = this.contentDocument.location;
        if (e.host !== i.host)
            return 0;
        if (e.pathname === i.pathname && e.search === i.search)
            return 0;
        if (-1 !== e.toString().indexOf("#"))
            return 0;
        if (anchorLinksToAttachment(e) || anchorLinksToTagOrCategoryPage(e))
            return 0;
        if (!isElementVisible(e))
            return 0;
        var r = cachedElementBoundingRect(e)
          , a = this._articleBoundingRect
          , l = Math.max(0, Math.max(a.top - (r.top + r.height), r.top - (a.top + a.height)));
        if (r.top < a.top)
            return 0;
        if (l > 200)
            return 0;
        if (Math.max(0, Math.max(a.left - (r.left + r.width), r.left - (a.left + a.width))) > 0)
            return 0;
        var o = i.pathname
          , s = e.pathname;
        if (this.prefixWithDateForNextPageURL) {
            if (-1 === e.pathname.indexOf(this.prefixWithDateForNextPageURL))
                return 0;
            o = o.substring(this.prefixWithDateForNextPageURL.length),
            s = s.substring(this.prefixWithDateForNextPageURL.length)
        }
        var c = s.substring(1).split("/");
        c[c.length - 1] || c.pop();
        var h = c.length
          , u = o.substring(1).split("/")
          , d = !1;
        u[u.length - 1] || (d = !0,
        u.pop());
        var m = u.length;
        if (h < m)
            return 0;
        for (var g = 0, f = 0, p = e.textContent, E = 0; E < h; ++E) {
            var v = c[E]
              , N = E < m ? u[E] : "";
            if (N !== v) {
                if (E < m - 2)
                    return 0;
                if (v.length >= N.length) {
                    for (var S = 0; v[v.length - 1 - S] === N[N.length - 1 - S]; )
                        S++;
                    S && (v = v.substring(0, v.length - S),
                    N = N.substring(0, N.length - S));
                    var T = v.indexOf(N);
                    -1 !== T && (v = v.substring(T))
                }
                t(N, v, p, this.pageNumber) ? f = Math.pow(3, E - h + 1) : g++
            }
            if (g > 1)
                return 0
        }
        var A = !1;
        if (e.search)
            for (var x in linkParameters = n(e.search),
            referenceParameters = n(i.search),
            linkParameters) {
                var y = linkParameters[x]
                  , b = x in referenceParameters ? referenceParameters[x] : null;
                if (b !== y)
                    if (null === b && (b = ""),
                    null === y && (y = ""),
                    y.length < b.length)
                        g++;
                    else if (t(b, y, p, this.pageNumber)) {
                        if (LinkURLSearchParameterKeyMatchRegex.test(x)) {
                            if (o.toLowerCase() !== s.toLowerCase())
                                return 0;
                            if (this.isWordPressSite() && d)
                                return 0;
                            A = !0
                        }
                        if (LinkURLBadSearchParameterKeyMatchRegex.test(x)) {
                            g++;
                            continue
                        }
                        f = Math.max(f, 1 / 3)
                    } else
                        g++
            }
        if (!f)
            return 0;
        if ((LinkURLPageSlashNumberMatchRegex.test(e.href) || LinkURLSlashDigitEndMatchRegex.test(e.href)) && (A = !0),
        !A && h === m && stringSimilarity(o, s) < .75)
            return 0;
        if (LinkURLArchiveSlashDigitEndMatchRegex.test(e))
            return 0;
        var C = 200 * (Math.pow(2, -g) + f) + 150 * l / 200;
        A && (C += 100),
        "LI" === e.parentNode.tagName && (C += 5);
        p = e.innerText;
        return LinkNextMatchRegEx.test(p) && (C += 15),
        LinkPageMatchRegEx.test(p) && (C += 10),
        LinkContinueMatchRegEx.test(p) && (C += 15),
        C
    },
    elementContainsEnoughTextOfSameStyle: function(e) {
        for (var t = "BODY" === e.tagName, n = t ? 2 : 3, i = function(e, i) {
            var r = 0
              , a = []
              , l = {
                P: 1,
                STRONG: 1,
                B: 1,
                EM: 1,
                I: 1,
                SPAN: 1
            };
            return t && (l.CENTER = 1,
            l.FONT = 1),
            function e(t, o) {
                if (t.nodeType !== Node.TEXT_NODE) {
                    if (t.nodeType === Node.ELEMENT_NODE && isElementVisible(t) && !(i && ++r > i || t._evaluatedForTextContent)) {
                        var s = t.tagName;
                        if ("IFRAME" !== s && "FORM" !== s) {
                            (l[s] || ("UL" === s || "OL" === s) && function(e) {
                                var t = e.children[0];
                                if (t)
                                    for (var n = t.children, i = n.length, r = 0; r < i; ++r)
                                        if ("none" !== getComputedStyle(n[r]).float)
                                            return !1;
                                return !0
                            }(t)) && o--;
                            var c = o + 1;
                            if (c < n)
                                for (var h = t.childNodes, u = h.length, d = 0; d < u; ++d)
                                    e(h[d], c)
                        }
                    }
                } else
                    /\S/.test(t.nodeValue) && a.push(t)
            }(e, 0),
            a
        }(e, 110), r = 1800 / scoreMultiplierForElementTagNameAndAttributes(e) / languageScoreMultiplierForTextNodes(i), a = {}, l = i.length, o = 0; o < l; ++o) {
            var s = i[o]
              , c = s.length
              , h = s.parentElement
              , u = window.getComputedStyle(h)
              , d = u.fontFamily + "|" + u.fontSize
              , m = Math.pow(c, 1.25);
            if (a[d]) {
                if ((a[d] += m) > r)
                    break
            } else
                a[d] = m
        }
        for (var d in a)
            if (a[d] > r)
                return !0;
        return !1
    },
    pointsToUseForHitTesting: function() {
        const e = window.innerWidth
          , t = e / 4
          , n = e / 2;
        return [[n, 800], [n, 600], [t, 800], [n, 400], [n - 128, 1100], [320, 700], [3 * t, 800], [e - 320, 700], [n - 128, 1300]]
    },
    clearVisualExaminationState: function() {
        for (var e = this._elementsEvaluatedForTextContent.length, t = 0; t < e; ++t)
            delete this._elementsEvaluatedForTextContent[t]._evaluatedForTextContent;
        this._elementsEvaluatedForTextContent = []
    },
    findArticleByVisualExamination: function() {
        this.clearVisualExaminationState();
        for (var e = this.pointsToUseForHitTesting(), t = e.length, n = 0; n < t; n++)
            for (var i = elementAtPoint(e[n][0], e[n][1]); i && !i._evaluatedForTextContent; i = i.parentElement) {
                if (VeryPositiveClassNameRegEx.test(i.className))
                    return new CandidateElement(i,this.contentDocument);
                if (!CandidateTagNamesToIgnore[i.tagName]) {
                    var r = i.offsetWidth
                      , a = i.offsetHeight;
                    if (!r && !a) {
                        var l = cachedElementBoundingRect(i);
                        r = l.width,
                        a = l.height
                    }
                    if (!(r < 280 || a < 295 || r * a < 17e4)) {
                        var o = this.elementContainsEnoughTextOfSameStyle(i);
                        if (i._evaluatedForTextContent = !0,
                        this._elementsEvaluatedForTextContent.push(i),
                        o && !(CandidateElement.candidateElementAdjustedHeight(i) < 295)) {
                            var s = new CandidateElement(i,this.contentDocument);
                            if (s.shouldDisqualifyDueToSimilarElements())
                                return null;
                            if (s.shouldDisqualifyDueToHorizontalRuleDensity())
                                return null;
                            if (s.shouldDisqualifyDueToHeaderDensity())
                                return null;
                            if (!s.shouldDisqualifyForDeepLinking())
                                return s
                        }
                    }
                }
            }
        return null
    },
    articleTextContent: function() {
        return this._articleTextContent
    },
    pageDescription: function() {
        for (var e = this.contentDocument.querySelectorAll("head meta[name]"), t = e.length, n = 0; n < t; ++n) {
            var i = e[n];
            if ("description" === i.getAttribute("name").toLowerCase()) {
                var r = i.getAttribute("content");
                if (r)
                    return r.trim()
            }
        }
        return null
    },
    articleTitleAndSiteNameFromTitleString: function(e) {
        const t = [" - ", " – ", " — ", ": ", " | ", " » "]
          , n = t.length;
        for (var i, r, a = this.contentDocument.location.host.replace(/^(www|m)\./, ""), l = a.replace(/\.(com|info|net|org|edu)$/, "").toLowerCase(), o = 0; o < n; ++o) {
            var s = e.split(t[o]);
            if (2 === s.length) {
                var c = s[0].trim()
                  , h = s[1].trim()
                  , u = c.toLowerCase()
                  , d = h.toLowerCase()
                  , m = Math.max(stringSimilarity(u, a), stringSimilarity(u, l))
                  , g = Math.max(stringSimilarity(d, a), stringSimilarity(d, l))
                  , f = Math.max(m, g);
                (!r || f > r) && (r = f,
                i = m > g ? {
                    siteName: c,
                    articleTitle: h
                } : {
                    siteName: h,
                    articleTitle: c
                })
            }
        }
        return i && r >= .6 ? i : null
    },
    readingListItemInformation: function() {
        var e, t = this.pageDescription(), n = !1;
        this.adoptableArticle() ? (e = this.articleTitle(),
        t = t || this.articleTextContent(),
        n = !0) : (e = this.contentDocument.title,
        this.contentDocument.body && (t = t || this.contentDocument.body.innerText));
        var i = ""
          , r = this.mainImageNode();
        return r && (i = r.src),
        e || (e = userVisibleURLString(this.contentDocument.location.href)),
        t || (t = ""),
        {
            title: e = e.trim().substring(0, 220),
            previewText: t = t.trim().substring(0, 220).replace(/[\s]+/g, " "),
            mainImageURL: i,
            isReaderAvailable: n
        }
    }
};
var ReaderArticleFinderJS = new ReaderArticleFinder(document);
